const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const errorHandler = require('./error-handle')
const useRoutes = require('../router/index')
const app = new Koa();
//新建一个Koa app

app.useRoutes = useRoutes;

app.use(bodyParser());
//使用bodyParser中间件解析前端的json pamas，query 类型的传值
app.useRoutes();
app.on('error', errorHandler);

module.exports = app;